package com.linkage.educloud.ah.bean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mr'Tang on 2018/10/29.
 */

public class TopicGroupBean {
    private String id;
    private String name;
    private String img;
    private String content;
    private String card_num;
    private String today_num;
    private String browse_num;

    public static List<TopicGroupBean> parseFromJson(JSONArray jsonArray) {
        List<TopicGroupBean> list = new ArrayList<>();
        for (int a = 0; a < jsonArray.length(); a++) {
            TopicGroupBean topic = new TopicGroupBean();
            JSONObject obj = null;
            try {
                obj = jsonArray.getJSONObject(a);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            topic.setId(obj.optString("id"));
            topic.setName(obj.optString("name"));
            topic.setImg(obj.optString("img"));
            topic.setContent(obj.optString("content"));
            topic.setCard_num(obj.optString("card_num"));
            topic.setToday_num(obj.optString("today_num"));
            topic.setBrowse_num(obj.optString("browse_num"));
            list.add(topic);
        }
        return list;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCard_num() {
        return card_num;
    }

    public void setCard_num(String card_num) {
        this.card_num = card_num;
    }

    public String getToday_num() {
        return today_num;
    }

    public void setToday_num(String today_num) {
        this.today_num = today_num;
    }

    public String getBrowse_num() {
        return browse_num;
    }

    public void setBrowse_num(String browse_num) {
        this.browse_num = browse_num;
    }
}
